package cn.com.connext.scrm.service;

import cn.com.connext.scrm.domain.master.MdmTemplateConfirm;
import cn.com.connext.scrm.repository.master.MdmTemplateConfirmRepository;
import cn.com.connext.scrm.service.dto.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.ZonedDateTime;
import java.util.List;

/***
 *  created by wangzhan on 2018/01/24
 *
 *  小程序 活动管理
 */
@Service
@Transactional
public class MdmTemplateConfirmService {

    @Autowired
    private MdmTemplateConfirmRepository mdmTemplateConfirmRepository;


    public JsonResult confrimTemplate(MdmTemplateConfirm req) {
        JsonResult result =new JsonResult();
        req.setCreateTime(ZonedDateTime.now());
        mdmTemplateConfirmRepository.save(req);
        result.setState(0);
        result.setMessage("添加成功");
        return  result;
    }

    public List<MdmTemplateConfirm> findByMdmHelpActivityIdAndCreateUnionId(Long mdmHelpActivityId,String createUnionId) {
        return mdmTemplateConfirmRepository.findByMdmHelpActivityIdAndCreateUnionId(mdmHelpActivityId,createUnionId);
    }
}
